#include "dialog.h"
#include "ui_dialog.h"

#include <QString>
#include <QFileDialog>
#include <QFileInfo>
#include <QDebug>
#include <QDateTime>

Dialog::Dialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Dialog)
{
    ui->setupUi(this);

    QString file = QFileDialog::getOpenFileName(this,"打开文件对话框","/");

    QFileInfo fileInfo(file);

//    QFileInfo对应的常用API接口
    qDebug() << "文件名: " << fileInfo.fileName();
    qDebug() << "文件大小: " << fileInfo.size();

    qDebug() << "文件创建时间" << fileInfo.created().toString();
    qDebug() << "文件最后修改时间" << fileInfo.lastModified().toString();
    qDebug() << "文件最后访问时间" << fileInfo.lastRead().toString();

    qDebug() << "是否为普通文件" << fileInfo.isFile();
    qDebug() << "是否有隐藏属性" << fileInfo.isHidden();
    qDebug() << "是否有可读属性" << fileInfo.isReadable();
    qDebug() << "是否有可写属性" << fileInfo.isWritable();
    qDebug() << "是否有执行属性" << fileInfo.isExecutable();

}

Dialog::~Dialog()
{
    delete ui;
}

